﻿Jxstar.currentPage = function() {
	var config = {param:{},initpage:function(page, define){},eventcfg:{}};

	var planstatusData = Jxstar.findComboData('planstatus');
	var moneytypeData = Jxstar.findComboData('moneytype');
	var projectjdData = Jxstar.findComboData('projectjd');
	var yesnoData = Jxstar.findComboData('yesno');
	var planyearData = Jxstar.findComboData('planyear');
	var plantype2Data = Jxstar.findComboData('plantype2');
	var planstatus2Data = Jxstar.findComboData('planstatus2');
	var baotypeData = Jxstar.findComboData('baotype');

	var cols = [
	{col:{header:'计划状态', width:81, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: planstatusData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: planstatusData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < planstatusData.length; i++) {
				if (planstatusData[i][0] == value)
					return planstatusData[i][1];
			}
		}}, field:{name:'money_plan__plan_status',type:'string'}},
	{col:{header:'计划编号', width:100, sortable:true}, field:{name:'money_plan__plan_code',type:'string'}},
	{col:{header:'项目名称', width:185, sortable:true}, field:{name:'money_plan__plan_name',type:'string'}},
	{col:{header:'项目类别', width:122, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: moneytypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: moneytypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < moneytypeData.length; i++) {
				if (moneytypeData[i][0] == value)
					return moneytypeData[i][1];
			}
		}}, field:{name:'money_plan__money_type',type:'string'}},
	{col:{header:'*预计总投资(万元)', width:128, sortable:true, defaultval:'0', align:'right',
		editable:true, hcss:'color:#0000ff;',
		editor:new Ext.form.NumberField({
			decimalPrecision:6, maxLength:12, allowBlank:false
		}),renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__plan_money',type:'float'}},
	{col:{header:'合同金额(万元)', width:100, sortable:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__money_contract',type:'float'}},
	{col:{header:'已付款金额(万元)', width:130, sortable:true, hidden:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__money_pay',type:'float'}},
	{col:{header:'截止上年底累计付款(万元)', width:182, sortable:true, defaultval:'0', align:'right',
		editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.NumberField({
			decimalPrecision:2, maxLength:12
		}),renderer:JxUtil.formatNumber(2)}, field:{name:'money_plan__sun_money1',type:'float'}},
	{col:{header:'今年截止统计月份实际付款(万元)', width:206, sortable:true, defaultval:'0', align:'right',
		editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.NumberField({
			decimalPrecision:6, maxLength:12
		}),renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__tran_money1',type:'float'}},
	{col:{header:'*今年剩余月份预计付款(万元)', width:183, sortable:true, defaultval:'0', align:'right',
		editable:true, hcss:'color:#0000ff;',
		editor:new Ext.form.NumberField({
			decimalPrecision:6, maxLength:12, allowBlank:false
		}),renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__tran_money2',type:'float'}},
	{col:{header:'今年预计完成付款(万元)', width:156, sortable:true, defaultval:'0', align:'right',
		editable:false,
		editor:new Ext.form.NumberField({
			decimalPrecision:6, maxLength:12
		}),renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__money_pay1',type:'float'}},
	{col:{header:'截止今年底累计付款额(万元)', width:185, sortable:true, defaultval:'0', align:'right',
		editable:false,
		editor:new Ext.form.NumberField({
			decimalPrecision:6, maxLength:12
		}),renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__sun_money',type:'float'}},
	{col:{header:'今年批复付款额(万元)', width:146, sortable:true, defaultval:'0', align:'right',
		editable:false,
		editor:new Ext.form.NumberField({
			decimalPrecision:6, maxLength:12
		}),renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__year_money',type:'float'}},
	{col:{header:'*下年计划付款(万元)', width:147, sortable:true, defaultval:'0', align:'right',
		editable:true, hcss:'color:#0000ff;',
		editor:new Ext.form.NumberField({
			decimalPrecision:6, maxLength:12, allowBlank:false
		}),renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__year_money1',type:'float'}},
	{col:{header:'下年计划实施内容', width:170, sortable:true, editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.TextField({
			maxLength:200
		})}, field:{name:'money_plan__year_content2',type:'string'}},
	{col:{header:'开工日期', width:100, sortable:true, editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.DateField({
			format: 'Y-m-d',
			minValue: '1900-01-01'
		}),
		renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'money_plan__project_sdate',type:'date'}},
	{col:{header:'竣工日期', width:100, sortable:true, editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.DateField({
			format: 'Y-m-d',
			minValue: '1900-01-01'
		}),
		renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'money_plan__project_edate',type:'date'}},
	{col:{header:'*当前形象进度', width:121, sortable:true, align:'center',
		editable:true, hcss:'color:#0000ff;',
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: projectjdData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false, allowBlank:false,
			value: projectjdData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < projectjdData.length; i++) {
				if (projectjdData[i][0] == value)
					return projectjdData[i][1];
			}
		}}, field:{name:'money_plan__project_process',type:'string'}},
	{col:{header:'*是否需要结转', width:116, sortable:true, defaultval:'0', align:'center',
		editable:true, hcss:'color:#0000ff;',
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: yesnoData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false, allowBlank:false,
			value: yesnoData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < yesnoData.length; i++) {
				if (yesnoData[i][0] == value)
					return yesnoData[i][1];
			}
		}}, field:{name:'money_plan__has_turn',type:'string'}},
	{col:{header:'授权形式', width:100, sortable:true, hidden:true}, field:{name:'money_plan__auth_type',type:'string'}},
	{col:{header:'预算年度', width:100, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: planyearData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: planyearData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < planyearData.length; i++) {
				if (planyearData[i][0] == value)
					return planyearData[i][1];
			}
		}}, field:{name:'money_plan__plan_year',type:'string'}},
	{col:{header:'申报部门', width:137, sortable:true}, field:{name:'money_plan__dept_name',type:'string'}},
	{col:{header:'是否上报国家局', width:100, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: yesnoData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: yesnoData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < yesnoData.length; i++) {
				if (yesnoData[i][0] == value)
					return yesnoData[i][1];
			}
		}}, field:{name:'money_plan__up_comp',type:'string'}},
	{col:{header:'国家局项目类别', width:128, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: plantype2Data
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: plantype2Data[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < plantype2Data.length; i++) {
				if (plantype2Data[i][0] == value)
					return plantype2Data[i][1];
			}
		}}, field:{name:'money_plan__money_type2',type:'string'}},
	{col:{header:'国家局项目状态', width:100, sortable:true, align:'center',
		editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: planstatus2Data
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: planstatus2Data[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < planstatus2Data.length; i++) {
				if (planstatus2Data[i][0] == value)
					return planstatus2Data[i][1];
			}
		}}, field:{name:'money_plan__plan_status2',type:'string'}},
	{col:{header:'建设规模和建设内容', width:100, sortable:true, hidden:true}, field:{name:'money_plan__plan_desc',type:'string'}},
	{col:{header:'父计划编号', width:100, sortable:true, hidden:true}, field:{name:'money_plan__plan_parentcode',type:'string'}},
	{col:{header:'计划批复金额(万元)', width:134, sortable:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__check_money',type:'float'}},
	{col:{header:'投资计划批复文号', width:123, sortable:true}, field:{name:'money_plan__check_fileno',type:'string'}},
	{col:{header:'立项批复日期', width:100, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'money_plan__project_checkdate',type:'date'}},
	{col:{header:'统计月份', width:100, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m') : '';
		}}, field:{name:'money_plan__stat_month',type:'date'}},
	{col:{header:'计划包属性', width:98, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: baotypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: baotypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < baotypeData.length; i++) {
				if (baotypeData[i][0] == value)
					return baotypeData[i][1];
			}
		}}, field:{name:'money_plan__bao_type',type:'string'}},
	{col:{header:'项目id', width:100, sortable:true, hidden:true}, field:{name:'money_plan__project_id',type:'string'}},
	{col:{header:'申报部门ID', width:100, sortable:true, hidden:true}, field:{name:'money_plan__dept_id',type:'string'}},
	{col:{header:'主键', width:100, sortable:true, hidden:true}, field:{name:'money_plan__plan_id',type:'string'}}
	];
	
	config.param = {
		cols: cols,
		sorts: null,
		hasQuery: '1',
		isedit: '1',
		isshow: '1',
		funid: 'money_compsub'
	};
	
	config.initpage = function(gridNode) {		var grid = gridNode.page;				//注册"今年剩余月份预计付款(万元)"编辑后事件，需要修改其它金额值		grid.on('afteredit', function(e){			if (e.field == 'money_plan__tran_money2') {				JxPm.calPlanMoney(e.record);			}		});				//子表关闭时汇总统计主记录金额，并刷新		grid.on('beforedestroy', function(g){			//取选择记录的主键值			var params = 'funid=money_tran_sub';			var parentId = g.tmpParentId;			var parentFunId = g.tmpParentFunId;			if (!parentFunId) return;			//设置请求的参数			params += '&pagetype=subeditgrid&eventcode=statmoney&parentid=' + parentId;						//执行处理的内容			var endcall = function(data) {				var pgrid = Ext.getCmp('node_' + parentFunId + '_editgrid');				//重新加载数据				if (pgrid) pgrid.getStore().reload();			};			//发送请求			Request.postRequest(params, endcall);		});	};
		
	return new Jxstar.GridNode(config);
}